import 'dart:convert';

import 'package:json_annotation/json_annotation.dart';

part 'feishu_response.g.dart';

@JsonSerializable(genericArgumentFactories: true)
class FeishuResponse<T> {
  int code = 0;
  String? msg;
  T? data;

  FeishuResponse();

  factory FeishuResponse.fromJson(
          Map<String, dynamic> json, T Function(dynamic json) fromJsonT) =>
      _$FeishuResponseFromJson<T>(json, fromJsonT);

  Map<String, dynamic> toJson(Object? Function(T value) toJsonT) =>
      _$FeishuResponseToJson(this, toJsonT);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
